from django.contrib import admin
from .models import Todo, Category, TaskTemplate

@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_display = ('name', 'user')
    search_fields = ('name',)
    list_filter = ('user',)

@admin.register(Todo)
class TodoAdmin(admin.ModelAdmin):
    list_display = ('title', 'user', 'priority', 'completed', 'due_date', 'category')
    search_fields = ('title', 'content')
    list_filter = ('user', 'completed', 'priority', 'category')
    list_editable = ('completed', 'priority')
    date_hierarchy = 'created_time'

@admin.register(TaskTemplate)
class TaskTemplateAdmin(admin.ModelAdmin):
    list_display = ('title', 'user', 'repeat_frequency', 'category', 'last_created_date')
    search_fields = ('title', 'content')
    list_filter = ('user', 'repeat_frequency', 'category')